/*     */ import java.io.BufferedReader;
/*     */ import java.io.FileNotFoundException;
/*     */ import java.io.FileReader;
/*     */ import java.io.InputStreamReader;
/*     */ import java.io.PrintStream;
/*     */ import java.util.ArrayList;
/*     */ import java.util.Enumeration;
/*     */ import java.util.HashMap;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import java.util.NoSuchElementException;
/*     */ import java.util.StringTokenizer;
/*     */ import java.util.zip.ZipEntry;
/*     */ import java.util.zip.ZipFile;
/*     */ 
/*     */ public class SymQuotes
/*     */ {
/*   7 */   public List<Float> open = new ArrayList();
/*   8 */   public List<Float> high = new ArrayList();
/*   9 */   public List<Float> low = new ArrayList();
/*  10 */   public List<Float> close = new ArrayList();
/*  11 */   public List<Integer> qty = new ArrayList();
/*  12 */   public List<String> date = new ArrayList();
/*     */   public int count;
/*  14 */   public String sym = "";
/*  15 */   public String code = "";
/*  16 */   public int bsq = 1;
/*  17 */   public int asq = 1;
/*  18 */   public String sd = "ns";
/*     */   private List<String> datesToRead;
/*  22 */   private Map<String, String> mmm = new HashMap(12);
/*     */ 
/*     */   public SymQuotes(String paramString1, List<String> paramList, int paramInt1, int paramInt2, String paramString2)
/*     */   {
/*  27 */     this.sym = paramString1;
/*  28 */     this.datesToRead = paramList;
/*  29 */     this.bsq = paramInt1;
/*  30 */     this.asq = paramInt2;
/*  31 */     this.sd = paramString2;
/*     */ 
/*  33 */     readQuotes();
/*  34 */     this.count = this.open.size();
/*     */ 
/*  36 */     if (!paramString2.equals("ns"))
/*  37 */       adjustSplit();
/*     */   }
/*     */ 
/*     */   public SymQuotes(String paramString1, List<String> paramList, int paramInt1, int paramInt2, String paramString2, String paramString3)
/*     */   {
/*  45 */     this.code = paramString1;
/*  46 */     this.datesToRead = paramList;
/*  47 */     this.bsq = paramInt1;
/*  48 */     this.asq = paramInt2;
/*  49 */     this.sd = paramString2;
/*     */ 
/*  51 */     this.mmm.put("01", "JAN");
/*  52 */     this.mmm.put("02", "FEB");
/*  53 */     this.mmm.put("03", "MAR");
/*  54 */     this.mmm.put("04", "APR");
/*  55 */     this.mmm.put("05", "MAY");
/*  56 */     this.mmm.put("06", "JUN");
/*  57 */     this.mmm.put("07", "JUL");
/*  58 */     this.mmm.put("08", "AUG");
/*  59 */     this.mmm.put("09", "SEP");
/*  60 */     this.mmm.put("10", "OCT");
/*  61 */     this.mmm.put("11", "NOV");
/*  62 */     this.mmm.put("12", "DEC");
/*     */ 
/*  64 */     readQuotes("bse");
/*  65 */     this.count = this.open.size();
/*     */ 
/*  67 */     if (!paramString2.equals("ns"))
/*  68 */       adjustSplit();
/*     */   }
/*     */ 
/*     */   public void adjustSplit()
/*     */   {
/*  76 */     float f = this.asq / this.bsq;
/*  77 */     int i = 0;
/*     */ 
/*  79 */     for (int j = this.count - 1; j >= 0; j--)
/*     */     {
/*  81 */       if (i != 0)
/*     */       {
/*  83 */         this.open.set(j, Float.valueOf(((Float)this.open.get(j)).floatValue() / f));
/*  84 */         this.high.set(j, Float.valueOf(((Float)this.high.get(j)).floatValue() / f));
/*  85 */         this.low.set(j, Float.valueOf(((Float)this.low.get(j)).floatValue() / f));
/*  86 */         this.close.set(j, Float.valueOf(((Float)this.close.get(j)).floatValue() / f));
/*  87 */         this.qty.set(j, Integer.valueOf((int)(((Integer)this.qty.get(j)).intValue() * f)));
/*     */       }
/*     */ 
/*  91 */       if (!this.sd.equals((String)this.date.get(j)))
/*     */         continue;
/*  93 */       i = 1;
/*  94 */       System.out.println(this.sym + ": Data before " + this.sd + " were split/Bonus adjusted");
/*     */     }
/*     */   }
/*     */ 
/*     */   public void resetAdjustSplit()
/*     */   {
/* 105 */     this.open = new ArrayList();
/* 106 */     this.high = new ArrayList();
/* 107 */     this.low = new ArrayList();
/* 108 */     this.close = new ArrayList();
/* 109 */     this.qty = (this.qty = new ArrayList());
/* 110 */     this.date = new ArrayList();
/*     */ 
/* 112 */     if (this.code.equals(""))
/* 113 */       readQuotes();
/*     */     else
/* 115 */       readQuotes("bse");
/*     */   }
/*     */ 
/*     */   private void readQuotes(String paramString)
/*     */   {
/* 128 */     for (int i = 0; i < this.datesToRead.size(); i++)
/*     */     {
/*     */       try
/*     */       {
/* 132 */         ZipFile localZipFile = new ZipFile("C:\\profitindicators\\data\\bse\\eq" + (String)this.datesToRead.get(i) + ".zip");
/* 133 */         Enumeration localEnumeration = localZipFile.entries();
/* 134 */         ZipEntry localZipEntry = (ZipEntry)localEnumeration.nextElement();
/*     */ 
/* 136 */         BufferedReader localBufferedReader = new BufferedReader(new InputStreamReader(localZipFile.getInputStream(localZipEntry)));
/*     */ 
/* 139 */         String str1 = localBufferedReader.readLine();
/* 140 */         str1 = localBufferedReader.readLine();
/*     */ 
/* 142 */         while (str1 != null)
/*     */         {
/* 144 */           StringTokenizer localStringTokenizer = new StringTokenizer(str1, ",");
/*     */ 
/* 146 */           String str2 = localStringTokenizer.nextToken().trim();
/*     */ 
/* 148 */           if (str2.equals(this.code))
/*     */           {
/* 150 */             this.sym = localStringTokenizer.nextToken().trim();
/*     */ 
/* 152 */             localStringTokenizer.nextToken();
/* 153 */             localStringTokenizer.nextToken();
/* 154 */             this.open.add(Float.valueOf(Float.parseFloat(localStringTokenizer.nextToken())));
/* 155 */             this.high.add(Float.valueOf(Float.parseFloat(localStringTokenizer.nextToken())));
/* 156 */             this.low.add(Float.valueOf(Float.parseFloat(localStringTokenizer.nextToken())));
/* 157 */             this.close.add(Float.valueOf(Float.parseFloat(localStringTokenizer.nextToken())));
/* 158 */             localStringTokenizer.nextToken();
/* 159 */             localStringTokenizer.nextToken();
/* 160 */             localStringTokenizer.nextToken();
/* 161 */             this.qty.add(Integer.valueOf(Integer.parseInt(localStringTokenizer.nextToken())));
/*     */             try
/*     */             {
/* 165 */               String str3 = (String)this.datesToRead.get(i);
/* 166 */               String str4 = str3.substring(str3.length() - 6, str3.length() - 4) + "-" + (String)this.mmm.get(str3.substring(str3.length() - 4, str3.length() - 2)) + "-" + str3.substring(str3.length() - 2);
/*     */ 
/* 170 */               this.date.add(str4.trim());
/*     */             }
/*     */             catch (NoSuchElementException localNoSuchElementException)
/*     */             {
/* 176 */               this.date.add("DDMMYY");
/* 177 */               System.out.println("Unable to read date for " + (String)this.datesToRead.get(i));
/* 178 */               System.out.println("Substituting DDMMYY");
/*     */             }
/*     */ 
/*     */           }
/*     */ 
/* 186 */           str1 = localBufferedReader.readLine();
/*     */         }
/*     */ 
/* 190 */         localBufferedReader.close();
/*     */       }
/*     */       catch (FileNotFoundException localFileNotFoundException)
/*     */       {
/* 195 */         System.out.println("Unable to find " + (String)this.datesToRead.get(i) + ".csv");
/*     */       }
/*     */       catch (Exception localException)
/*     */       {
/* 199 */         localException.printStackTrace();
/*     */       }
/*     */     }
/*     */   }
/*     */ 
/*     */   private void readQuotes()
/*     */   {
/* 216 */     for (int i = 0; i < this.datesToRead.size(); i++)
/*     */     {
/*     */       try
/*     */       {
/* 220 */         FileReader localFileReader = new FileReader("C:\\profitindicators\\data\\nse\\" + (String)this.datesToRead.get(i) + ".csv");
/* 221 */         BufferedReader localBufferedReader = new BufferedReader(localFileReader);
/* 222 */         String str1 = localBufferedReader.readLine();
/*     */ 
/* 224 */         while (str1 != null)
/*     */         {
/* 226 */           StringTokenizer localStringTokenizer = new StringTokenizer(str1, ",");
/* 227 */           String str2 = localStringTokenizer.nextToken();
/* 228 */           String str3 = localStringTokenizer.nextToken();
/*     */ 
/* 230 */           if ((str2.equals(this.sym)) && (str3.equals("EQ")))
/*     */           {
/* 232 */             this.open.add(Float.valueOf(Float.parseFloat(localStringTokenizer.nextToken())));
/* 233 */             this.high.add(Float.valueOf(Float.parseFloat(localStringTokenizer.nextToken())));
/* 234 */             this.low.add(Float.valueOf(Float.parseFloat(localStringTokenizer.nextToken())));
/* 235 */             this.close.add(Float.valueOf(Float.parseFloat(localStringTokenizer.nextToken())));
/* 236 */             localStringTokenizer.nextToken();
/* 237 */             localStringTokenizer.nextToken();
/* 238 */             this.qty.add(Integer.valueOf(Integer.parseInt(localStringTokenizer.nextToken())));
/* 239 */             localStringTokenizer.nextToken();
/* 240 */             String str4 = localStringTokenizer.nextToken();
/* 241 */             if (str4.length() < 11) {
/* 242 */               this.date.add("0" + str4); break;
/*     */             }
/* 244 */             this.date.add(str4);
/* 245 */             break;
/*     */           }
/*     */ 
/* 249 */           str1 = localBufferedReader.readLine();
/*     */         }
/*     */ 
/* 253 */         localBufferedReader.close();
/*     */       }
/*     */       catch (FileNotFoundException localFileNotFoundException)
/*     */       {
/* 258 */         System.out.println("Unable to find " + (String)this.datesToRead.get(i) + ".csv");
/*     */       }
/*     */       catch (Exception localException)
/*     */       {
/* 262 */         localException.printStackTrace();
/*     */       }
/*     */     }
/*     */   }
/*     */ 
/*     */   public static void main(String[] paramArrayOfString)
/*     */   {
/* 274 */     BseFileDownloader localBseFileDownloader = new BseFileDownloader();
/* 275 */     localBseFileDownloader.downloadFiles();
/* 276 */     SymQuotes localSymQuotes = new SymQuotes("500002", localBseFileDownloader.datesToRead, 1, 1, "ns", "bse");
/*     */ 
/* 278 */     System.out.println(localSymQuotes.date.size());
/* 279 */     System.out.println((String)localSymQuotes.date.get(localSymQuotes.date.size() - 1));
/* 280 */     System.out.println(localSymQuotes.open.size());
/* 281 */     System.out.println(localSymQuotes.close.size());
/*     */   }
/*     */ }

/* Location:           C:\Users\Deebak\Downloads\profitindicatorsv2-05.jar
 * Qualified Name:     SymQuotes
 * JD-Core Version:    0.6.0
 */